import book.*;
import user.*;
import java.util.Scanner;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-18
 */
public class Main {
    //返回值可接收两个子类
    public static User login() {
        System.out.print("请输入你的姓名:>");
        Scanner scan = new Scanner(System.in);
        String userName = scan.nextLine();
        System.out.println("请选择你的身份: 1.管理员  0.普通用户");
        int choice = scan.nextInt();
        if (choice == 1) {
            System.out.println("开启管理员模式");
            return new AdminUser(userName);
        } else {
            System.out.println("开启普通用户模式");
            return new NormalUser(userName);
        }
    }
    public static void main(String[] args) {
        //准备数据
        BookList bookList = new BookList();
        //用户登录
        User user = login();
        while (true) {
            //打印菜单
            user.menu();
            //操作书架
            user.doOperation(bookList);
        }
    }
}
